package com.ny.mapper;

import com.ny.entity.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {

    @Insert("insert into user(username,password,nickname,phone,email,is_active,created_time) values(#{username},#{password},#{nickname},#{phone},#{email},#{isActive},#{createdTime})")
    int addUser(User user);

    @Select("select * from user where username=#{username} and password=#{password}")
    public User findUser(@Param("username") String username, @Param("password") String password);

    @Select("select * from user where email= #{email}")
    public User findUserByEmail(String email);

    @Update("update user set password = #{password} where email = #{email}")
    public int updatePassword(@Param("password") String password, @Param("email") String email);

}
